﻿using ARchGL.Platform.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using WebApiClient.DataAnnotations;

namespace ARchGL.Platform.Jianwei.InputModels
{
    [Serializable]
    public class EncryptRequestInputBase<T> : DesEncryptKeyBase
    {
        public T Source { get; set; }
        public EncryptRequestInputBase()
        {

        }

        [AliasAs("content")]
        [JsonProperty("content")]
        public string EncDataString
        {
            get
            {
                string encStr = "";
                try
                {
                    encStr = DES.Encode(JsonConvert.SerializeObject(Source), _SecrytKey);
                }
                catch (Exception ex)
                {

                }
                return encStr;
            }
        }
    }
    [Serializable]
    public class UploadAttendanceInput
    {
        [AliasAs("Count")]
        [JsonProperty("Count")]
        public int Count { get => Logs != null ? Logs.Count : 0; }

        [AliasAs("logs")]
        [JsonProperty("logs")]
        public List<UploadAttendanceItem> Logs { get; set; }
    }

    public class UploadAttendanceItem
    {
        /// <summary>
        /// 设备序列号
        /// </summary>
        [AliasAs("sn")]
        [JsonProperty("sn")]
        public string SN { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [AliasAs("user_id")]
        [JsonProperty("user_id")]
        public string UserId { get; set; }

        /// <summary>
        /// 识别时间
        /// </summary>
        [AliasAs("recog_time")]
        [JsonProperty("recog_time")]
        public DateTime RecogTime { get; set; }
    }
}
